#pragma once
#include <chrono>
#include <memory>
#include <fstream>
#include <iostream>
#include <string>
#include <Eigen/Geometry>
#include <pcl/point_types.h>
#include <pcl/io/pcd_io.h>
#include <geometry_msgs/msg/transform_stamped.hpp>
#include <pcl/common/transforms.h>
#include <pcl_conversions/pcl_conversions.h>
#include "jsoncpp/json/json.h"
struct Shift_data
{
    double x;
    double y;
    double angle;
};
struct Sample_seat
{
    int direct;
    int times;
    double seat_start;
    double seat_end;
};
double get_angle(int direct,double seat_start,double seat_end,pcl::PointCloud<pcl::PointXYZ>::Ptr cloud);
void global_json(std::string name);
class Compare_to_shift
{
    public:
        Compare_to_shift();
        void set_source_cloud(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud);
        void set_target_cloud(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud);
        void filter_cloud(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud);
        void transform_cloud(int index,Shift_data &sf_d);
        void cal_angle(int direct,double seat_start,double seat_end,pcl::PointCloud<pcl::PointXYZ>::Ptr cloud);
        void get_shift(void);
        void read_json_seat(void);
        void convert_json_name(std::string name);
        void get_convert_json(void);
        
        int get_comp_cloud(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud);
        //void transform_cloud0(Shift_data &sf_d);
        std::string json_name;
        Sample_seat ss_seat[4];
        Shift_data shift_data;
        Shift_data tem_shift_data;
        Shift_data global_data;
    private:    
        pcl::PointCloud<pcl::PointXYZ>::Ptr source_cloud;
        pcl::PointCloud<pcl::PointXYZ>::Ptr target_cloud;
        pcl::PointCloud<pcl::PointXYZ>::Ptr transformed_cloud0;
        pcl::PointCloud<pcl::PointXYZ>::Ptr transformed_cloud1;

};